package ccc.virus.attend.controller;

import ccc.virus.attend.entity.Attend;
import ccc.virus.attend.service.AttendService;
import ccc.virus.attend.vo.QueryCondition;
import ccc.virus.common.page.PageQueryBean;
import ccc.virus.user.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;

/**
 * Created by JackWangon[www.aiprogram.top] 2017/6/20.
 */
@Controller
@RequestMapping("attend")
public class AttendController {

    @Autowired
    private AttendService attendService;

    @RequestMapping
    public String toAttend(){
        return "attend";
    }

    /**
     *@Author JackWang [www.coder520.com]
     *@Date 2017/6/21 20:35
     *@Description 签到
     */
    @RequestMapping("/sign")
    @ResponseBody
    public String signAttend(@RequestBody Attend attend, HttpSession session) throws Exception {
      attendService.signAttend(attend);
      return "succ";
    }

    /**
    * @Author:CCC
    * @Description:分页查询
    * @Date:2018/8/28 0028
    */
    @RequestMapping("attendList")
    @ResponseBody
    public PageQueryBean attendList(QueryCondition condition){
        PageQueryBean result = attendService.listAttend(condition);
        return result;
    }
}
